package com.autumn.service;

import com.spring.Autowired;
import com.spring.BeanNameAware;
import com.spring.Component;

//@Component("userService")
//@Scope("prototype")

/**
 * BeanNameAware：回调bean名字
 * BeanFactoryAware：回调bean创建工厂
 * 回调方法均继承自BeanPostProcessor，强转为BeanPostProcessor后，调用初始化前或初始化后方法来set需要回调的值
 */
@Component
public class UserService implements UserInterface, BeanNameAware {

    @Autowired
    private OrderService orderService;

    @AutumnValue("xxx")
    private String test;

    private String beanName;

    public void test() {
        System.out.println(beanName);
    }

    @Override
    public void setBeanName(String name) {
        this.beanName = name;
    }
}
